package com.cloudwise.plugin;

import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Signature;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2021/10/21 11:02
 * @description：我自己的mybatis插件
 * @modified By：
 * @version: 1.0
 */
//  int update(MappedStatement ms, Object parameter) throws SQLException;
@Intercepts(@Signature(type = Executor.class,method = "update",args = {MappedStatement.class,Object.class}))
public class MyPlugin implements Interceptor {
    @Override
    public Object intercept(Invocation invocation) throws Throwable {
        System.out.println("插件开始运行");
        Object proceed = invocation.proceed();
        System.out.println("插件结束运行");
        return proceed;
    }
}
